var express = require('express');
var router = express.Router();

const { getLogs, addLogs, delLogs } = require('../service/logsService.js');//解构出来函数

/* GET home page. */
router.get('/getLogs', async function (req, res, next) {
    //绘制数据
    const data = await getLogs();

    res.send(data);
});

router.post('/addLogs', async function (req, res, next) {
    //绘制数据
    const admins = req.body;
    console.log(admins)
    const data = await addLogs(admins);
    res.send(data);
});

//软删除
router.post('/delLogs', async function (req, res, next) {
    //绘制数据
    const id = req.body;
    console.log(id)
    const data = await delLogs(id);
    res.send(data);
});

module.exports = router;
